package com.qingcloud.fexecutor.base.enums;

public enum BaseAppParamTypeEnum {

    APP(1, "应用参数"),
    ENV(2, "环境变量"),
    PORT(3, "端口绑定"),
    VOLUMN(4, "目录挂载"),
    HOST(5, "HOST绑定");

    public final Integer code;
    public final String name;

    BaseAppParamTypeEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (BaseAppParamTypeEnum type : BaseAppParamTypeEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static BaseAppParamTypeEnum findByName(String name) {
        for (BaseAppParamTypeEnum type : BaseAppParamTypeEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }
}
